import java.util.ArrayList;
import java.util.Random;
import java.util.Stack;

public class Util {

	public static int showRandomInteger(int start, int end) {
		Random aRandom = new Random();
		int aStart, aEnd;
		aStart = start;
		aEnd = end;

		if (aStart > aEnd) {
			throw new IllegalArgumentException("Start cannot exceed End.");
		}
		long range = (long) aEnd - (long) aStart + 1;
		long fraction = (long) (range * aRandom.nextDouble());
		int randomNumber = (int) (fraction + aStart);
		return randomNumber;
	}
	
	public static int stackSort(ArrayList<Stack> list) {

		int smallStackIndex = 0;

		for (int i = 0; i < list.size(); i++) {
			if (i + 1 < list.size()) {
				if (list.get(smallStackIndex).size() < list.get(i + 1).size()) {
					smallStackIndex = smallStackIndex;
				} else {
					smallStackIndex = i + 1;
				}
			}

		}
		return smallStackIndex;
	}
}
